-
Notifications
You must be signed in to change notification settings - Fork 10.5k
🌸 More @abi
checking + Finish implementing @abi
(SE-0476)
#81393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
beccadax
merged 12 commits into
swiftlang:release/6.2
from
beccadax:abi-let-you-graduate-6.2
May 9, 2025
Merged
🌸 More @abi
checking + Finish implementing @abi
(SE-0476)
#81393
beccadax
merged 12 commits into
swiftlang:release/6.2
from
beccadax:abi-let-you-graduate-6.2
May 9, 2025
+360
−188
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The decl checker was effectively not being run on these because we weren’t typechecking the PBD and typechecking the VarDecl itself is basically a no-op.
Macro expansions are now treated like a part of the source file they belong to, for purposes of the “second declaration is the one that’s diagnosed” rule. This helps stabilize a behavior that was easy to perturb.
CustomAttr backs four different features, each of which requires a different behavior in `@abi`: • Global actors: Permitted (and permitted to vary) since they can affect mangling • Result builders: Forbidden inside an `@abi` since they have no ABI impact • Property wrappers: Forbidden both inside an `@abi` and on a decl with an `@abi` since it’s not clear how we would apply `@abi` to the auxiliary decls • Attached macros: Forbidden inside an `@abi` since an ABI-only decl has no body, accessors, members, peers, extensions, or (currently) conformances Implement these behaviors (outside of `ABIDeclChecker` since they can’t be described there). Macro-related tests are not included in this commit; they require matching swift-syntax changes which are being negotiated.
SwiftSyntaxParser is already doing this, and we already diagnosed it in Sema anyway, so we’re just moving that diagnostic earlier so the ASTGen testing mode is happy. Also adding compiler tests for it. Macro-related tests are not included in this commit; they require matching swift-syntax changes which are being negotiated.
It’s not clear how `@abi` would apply to the auxiliary decl used for `lazy`.
Inlinability doesn’t affect the mangling except in function specializations, which are applied after the fact and should never mangle in information from an ABI-only decl. That means we can simply ban these from `@abi` instead of inferring them. Also adds some assertions to help double-check that SIL never tries to directly mangle or retrieve inlinability info from an ABI-only decl.
It has indirect effects on the accessors, so it shouldn’t matter, but we can defensively redirect the query to the API counterpart anyway. This was the last `InferredInABIAttr` attribute, so we can now remove all of the infrastructure involved in supporting attribute inference.
When a language feature is used inside an `@abi` attribute, we should behave as though it was used on its counterpart. This was already half-implemented—we ensured the counterpart would use the feature—but we didn’t make the ABI decl aware that the counterpart was its parent for feature detection purposes. As a result, we would print `#if` inside the `@abi` attribute, which isn’t valid.
Additional tests for the previous commit “Diagnose CustomAttrs as needed in `@abi`”.
Additional tests for the previous commit “[Legacy parser] No freestanding macros in `@abi`”.
Per a comment in the review thread that the comma in a multi-variable pattern binding makes it look like the `@abi` attribute has several arguments.
This includes changing the feature name so that compilers with the experimental feature don’t accidentally pick up content that only works in the final version. Resolves rdar://150065196.
With swiftlang/swift-syntax#3074 @swift-ci please test |
nkcsgexi
approved these changes
May 9, 2025
This is an important cherry-pick to avoid source compatibility issues if we don't. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@abi
attribute) has been approved; this PR pulls in all work done on the feature since release/6.2 branched from main. This mostly consists of typechecking changes that are specific to code using@abi
.@abi
attribute@abi
checking #80383, Finish implementing@abi
(SE-0476) #81115@abi
attribute; we don't believe there are any adopters yet, and even if there are, the language feature name has been changed to protect against module interface condfails.Note: This needs to land simultaneously with swiftlang/swift-syntax#3074.